<template>
  <div class='container'>
    <el-dialog
    title="预览文章"
    :visible="previewVisible"
    width="50%"
    @close="closeDialog"
    >
      <div class="title">
          <h2>{{articleInfo.title}}</h2>
          <div>
            <span>{{articleInfo.createTime|parseTimeByString}}</span>
            <span>{{articleInfo.username}}</span>
            <span class="el-icon-view"></span>
            <span>{{articleInfo.visits}}</span>
          </div>
        </div>
        <div class="content" v-html="articleInfo.articleBody"></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    previewVisible: {
      type: Boolean,
      default: false
    },
    articleInfo: {
      type: Object,
      required: true
    }
  },
  methods: {
    closeDialog () {
      this.$emit('update:previewVisible', false)
    },
    checkinfo () {
      console.log(this.articleInfo)
    }
  }
}
</script>

<style scoped lang='scss'>
span{
  margin-right: 5px;
}
</style>
